/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package be.ugent.medirem.persistence.util;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Thomas Roelens <thomas.roelens@ugent.be>
 */
public enum TaskStatus {

    NOT_SEEN("Not Completed",'N'),
    NOT_COMPLETED("Not Completed",'N'),
    COMPLETED("Completed", 'C'),
    FORGOTTEN("Forgotten", 'F'),
    IGNORED("Ignored",'I');

    private String title;
    private char code;

    private static Map<Character, TaskStatus> map = new HashMap<Character, TaskStatus>();
    static {
        for (TaskStatus t : TaskStatus.values())
            map.put(t.code, t);
    }

    TaskStatus(String title, char code) {
        this.title = title;
        this.code = code;
    }

    public String getTitle() {
        return title;
    }

    public char getCode() {
        return code;
    }

    public static TaskStatus getTaskStatusByCode(char c) {
        if (map.containsKey(c))
            return map.get(c);
        return null;
    }

    @Override
    public String toString() {
        return this.title;
    }
}
